//
//  ViewController.swift
//  UseUserDefaults
//
//  Created by liy on 2025/1/18.
//

import UIKit

class ViewController: UIViewController {

	@IBOutlet weak var textView: UITextView!
	override func viewDidLoad() {
		super.viewDidLoad()
		
	}
	
	

	@IBAction func save(_ sender: Any) {
		UserDefaults.standard.set("hello boy", forKey: "data")
		print("saved .")
	}
	
	@IBAction func get(_ sender: Any) {
		if let str = UserDefaults.standard.object(forKey: "data") as? String{
			textView.text = str
		}else {
			textView.text = "no value."
		}
		
	}
}

